import { createContext, useState, useContext } from "react";

const AuthContext = createContext();

export const useAuth = () => {
    return useContext(AuthContext);
};

const AuthProvider = (props) => {
    const [login, setLogin] = useState(localStorage.getItem("login") || false);

    return (
        <AuthContext.Provider value={{ login, setLogin }}>{props.children}</AuthContext.Provider>
    );
};
export default AuthProvider;
